<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>设置当前 magic_quotes_runtime 配置选项的激活状态</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.set-magic-quotes-runtime" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">set_magic_quotes_runtime</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">set_magic_quotes_runtime</span> &mdash; <span class="dc-title">设置当前 magic_quotes_runtime 配置选项的激活状态</span></p>

 </div>
 
 <div id="function.set-magic-quotes-runtime-refsynopsisdiv">
  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function was
<em class="emphasis">DEPRECATED</em> in PHP 5.3.0, and <em class="emphasis">REMOVED</em> as of PHP 7.0.0.</p></div>
 </div>
 
 <div class="refsect1 description" id="refsect1-function.set-magic-quotes-runtime-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>set_magic_quotes_runtime</strong></span>
    ( <span class="methodparam"><span class="type">bool</span> <code class="parameter">$new_setting</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   设置当前 <a href="info.configuration.html#ini.magic-quotes-runtime" class="link">magic_quotes_runtime</a> 配置选项的激活状态。
  </p>
 </div>

 
  <div class="refsect1 errors" id="refsect1-function.set-magic-quotes-runtime-errors">
 <h3 class="title">错误／异常</h3>
 <p class="para">
  自 PHP 5.3 起，该函数已经被弃用，执行它的时候会抛出 E_DEPRECATED 异常。
  自 PHP 5.4 起，尝试开启  magic quotes 时该函数会产生一个 E_CORE_ERROR 错误。
 </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.set-magic-quotes-runtime-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">new_setting</code></dt>

     <dd>

      <p class="para">
       关闭是 <strong><code>FALSE</code></strong>，开启是 <strong><code>TRUE</code></strong>。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.set-magic-quotes-runtime-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.set-magic-quotes-runtime-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-534">
    <p><strong>Example #1 <span class="function"><strong>set_magic_quotes_runtime()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;创建临时文件指针<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tmpfile</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;写入一些数据<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'\'PHP\'&nbsp;is&nbsp;a&nbsp;Recursive&nbsp;acronym'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;没有&nbsp;magic_quotes_runtime<br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">set_magic_quotes_runtime</span><span style="color: #007700">(</span><span style="color: #0000BB">false</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">'Without&nbsp;magic_quotes_runtime:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">fread</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">64</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;有&nbsp;magic_quotes_runtime<br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">set_magic_quotes_runtime</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">'With&nbsp;magic_quotes_runtime:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">fread</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">64</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;清理<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Without magic_quotes_runtime: &#039;PHP&#039; is a Recursive acronym
With magic_quotes_runtime: \&#039;PHP\&#039; is a Recursive acronym
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.set-magic-quotes-runtime-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="get_magic_quotes_gpc.html" class="function" rel="rdfs-seeAlso">get_magic_quotes_gpc()</a> - 获取当前 magic_quotes_gpc 的配置选项设置</span></li>
    <li class="member"><span class="function"><a href="get_magic_quotes_runtime.html" class="function" rel="rdfs-seeAlso">get_magic_quotes_runtime()</a> - 获取当前 magic_quotes_runtime 配置选项的激活状态</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>